Repository navigation
feat(enterprise): add optional enterprise integration contracts - #63
Conversation
Defines frozen identity, tenancy, quota and credit authority contracts with explicit adapters and deny-by-default missing authority, plus an administrator-only dry-run preview at /admin/enterprise/preview. ENTERPRISE_PREVIEW_ENABLED defaults to off, and registering the contracts activates nothing.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
multillm-proxy | 13231aa | Oct 09 2026, 05:19 AM |
b2f2fd7
into
integrate/gateway-waves-1-5
Summary
Adds optional enterprise integration contracts: typed identity, tenancy, quota and credit boundaries that later organisation, SSO, provisioning and payment modules can build on. This PR adds no enterprise feature. Existing single-principal authentication, key controls and budgets stay authoritative, and registering the contracts activates nothing.
services/enterprise_contract.py, matching frozen classes inworker/enterprise-contract.mjs):TenantContext {principal_id, org_id?, team_id?, grants_revision}, where a team requires an organisation;IdentityAssertion;QuotaAuthorityandCreditAuthority, each withreserve,commitandreconcile;PaymentEventwith an idempotency ID.AuthorityDenied.ENTERPRISE_PREVIEW_ENABLEDdefaults to off; malformed values are off with one warning.GET /admin/enterprise/previewreturns 404 before authentication.dry_run: true,activation: false, contract names, registered authorities, supported operations) withCache-Control: no-store, and it calls no authority and mutates nothing.Details are in
docs/enterprise-contracts.md.Shared registrations
tests/test_enterprise_contracts_worker.mjsintest:worker.worker/enterprise-contract.mjsin the edge module inventory;app.get('/admin/enterprise/preview')in the Flask route inventory.ENTERPRISE_PREVIEW_ENABLEDin the Container env keys.app.pygains one call,register_enterprise_preview_routes(app).No migration, tables, Worker routes or browser-readable headers.
Tests
tests/test_enterprise_contracts.pyandtests/test_enterprise_contracts_worker.mjscover:tests/test_usage_ledger.py::test_prune_removes_old_raw_rows_and_rollups, which waits at most 5 seconds for a background flush. It failed once under heavy machine load, passed in the two earlier full runs, and passes 3 of 3 times on its own; this PR doesn't touch the usage ledger. ruff, mypy and bandit are clean.npm run test:worker: 1,672 passed.npm run test:integration: 7 passed.migrations:check(28 contiguous, additive migrations),test:deploy, free routes, client headers and thewrangler deploy --dry-runbundle all pass.tests/test_frontend_build.mjsfails locally because@tailwindcss/cliis not installed. It fails the same way on main.Test fixture fix
The first full run failed
test_registered_preview_auth_and_zero_mutation(302 instead of 403).tests/test_shadow_eval_routes.pydropsapp,route_helpersandroutes.corefromsys.modulesand re-imports them, but the cached preview route module keeps its original login and admin checks. The fixture now patchesAuthServicein the globals of the exact checks the route calls. The ordering that reproduced the failure now passes.CI notes
python/nodejobs: the dependency-audit steps fail on every branch, including main. fix(deps): clear the CI dependency audit advisories #42 fixes that.AdmissionCoordinatorDurable Object migration, whichwrangler versions uploadcannot apply. This is expected untilwrangler deployruns on main.This is part of Wave 6. It is based on
integrate/gateway-waves-1-5, the Wave 5 integration branch (#60). The README line comes with the Wave 6 integration PR.